import UserInfo from "@/types/user/UserInfo";
import request from "@/base/request";
export default async function getUserInfo(UserId):Promise<UserInfo> {
    if(!localStorage.getItem('token')){
        throw new Error('请先登录')
    }

    const response=(await request.get(`/user/userBaseInfo/getUserInfo?userId=${(UserId==null || UserId==undefined ? "" : UserId)}`)).data;
    if(response.code==200){
        return response.data;
    }else{
        throw new Error(response.msg);
    }
}